package br.com.winesys.geta.databinding.component.editor;

import java.text.NumberFormat;
import java.text.ParseException;

public class DoubleEditor extends NumberEditor {

	public DoubleEditor() {
		super();
		setFormat("#,##0.00");
	}

	public DoubleEditor(String format) {
		super(format);
	}

	public DoubleEditor(NumberFormat format) {
		super(format);
	}

	@Override
	public Object getValue() {
		try {
			Object value = getText();
			return this.numberFormat.parse(value.toString()).doubleValue();
		} catch (ParseException ex) {
			return null;
		}
	}
}
